package api
import "callapi"
import "net/http"
import "encoding/json"
import "fmt"
import "io/ioutil"

type Token struct {
	TokenId string
	IssueTime string
	ExpireTime string
	Issuer string
}

func (c  CallBack) ResponseValidate(resp *http.Response, ctx *callapi.RestBirdCtx) bool {
    body, _ := ioutil.ReadAll(resp.Body)
	var token Token
	err := json.Unmarshal(body, &token)
	fmt.Println("----------------" +token.TokenId)
	if err != nil {
		fmt.Printf(err.Error())
	}
	ctx.SetVars("x_auth_token", token.TokenId)
	return token.TokenId != ""
}
